/*
 Copyright (C) 2008  Maurizio Monticelli

 This program is free software; you can redistribute it and/or modify it under the terms of the 
 GNU General Public License as published by the Free Software Foundation; either version 2 of the 
 License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
 even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
 Public License for more details.

 You should have received a copy of the GNU General Public License along with this program; if not, write 
 to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 
*/

package ch.justdoit.andriodrpncalc.view;

import android.content.Context;
import android.widget.AbsoluteLayout;
import ch.justdoit.andriodrpncalc.model.Model;
import ch.justdoit.andriodrpncalc.model.command.*;
import ch.justdoit.andriodrpncalc.view.buttons.*;

public class KeyMenuMathCommands extends MenuBar {
	public int WIDTH = 90;
	public int HEIGHT = 120;
	public static String NAME = "math";
	public KeyMenuMathCommands(Context context,  Model _model, MenuGroup menuGroup) {
		super(context, _model, menuGroup, KeyMenuMathCommands.NAME);
		
		int x = 0;
	    int y = 0;
	    
	    AbsoluteLayout layer1 = new AbsoluteLayout(context);
	    layerList.add(layer1);

	    ButtonCommand btn1 = new ButtonCommand(context, mModel, new AbsCommand(mModel));
	    layer1.addView(btn1, 
    			new AbsoluteLayout.LayoutParams(btn1.WIDTH, btn1.HEIGHT, x, y)
    	);
		x = x + btn1.WIDTH;

		ButtonCommand btn2 = new ButtonCommand(context, mModel, new AcosCommand(mModel));
		layer1.addView(btn2, 
    			new AbsoluteLayout.LayoutParams(btn2.WIDTH, btn2.HEIGHT, x, y)
    	);
		x = x + btn2.WIDTH;
		
		ButtonCommand btn3 = new ButtonCommand(context, mModel, new AsinCommand(mModel));
		layer1.addView(btn3, 
    			new AbsoluteLayout.LayoutParams(btn3.WIDTH, btn3.HEIGHT, x, y)
    	);
		x = x + btn3.WIDTH;

		ButtonCommand btn4 = new ButtonCommand(context, mModel, new AtanCommand(mModel));
		layer1.addView(btn4, 
    			new AbsoluteLayout.LayoutParams(btn4.WIDTH, btn4.HEIGHT, x, y)
    	);
		x = x + btn4.WIDTH;

		ButtonCommand btn5 = new ButtonCommand(context, mModel, new Atan2Command(mModel));
		layer1.addView(btn5, 
    			new AbsoluteLayout.LayoutParams(btn5.WIDTH, btn5.HEIGHT, x, y)
    	);
		x = x + btn5.WIDTH;

		ButtonCommand btn6 = new ButtonCommand(context, mModel, new CeilCommand(mModel));
		layer1.addView(btn6, 
    			new AbsoluteLayout.LayoutParams(btn6.WIDTH, btn6.HEIGHT,  x, y)
    	);
		x = x + btn6.WIDTH;

		y = y + btn6.HEIGHT;
		
		WIDTH = x;
		HEIGHT = y;

		x = 0;
		y = 0;
	    
	    AbsoluteLayout layer2 = new AbsoluteLayout(context);
	    layer2.setVisibility(INVISIBLE);

	    layerList.add(layer2);
	    
	    
	    ButtonCommand btn11 = new ButtonCommand(context, mModel, new CosCommand(mModel));
	    layer2.addView(btn11, 
    			new AbsoluteLayout.LayoutParams(btn11.WIDTH, btn11.HEIGHT, x, y)
    	);
		x = x + btn11.WIDTH;

		ButtonCommand btn12 = new ButtonCommand(context, mModel, new ExpCommand(mModel));
		layer2.addView(btn12, 
    			new AbsoluteLayout.LayoutParams(btn12.WIDTH, btn12.HEIGHT, x, y)
    	);
		x = x + btn12.WIDTH;
		
		ButtonCommand btn13 = new ButtonCommand(context, mModel, new FloorCommand(mModel));
		layer2.addView(btn13, 
    			new AbsoluteLayout.LayoutParams(btn13.WIDTH, btn13.HEIGHT, x, y)
    	);
		x = x + btn13.WIDTH;

		ButtonCommand btn14 = new ButtonCommand(context, mModel, new LnCommand(mModel));
		layer2.addView(btn14, 
    			new AbsoluteLayout.LayoutParams(btn14.WIDTH, btn14.HEIGHT, x, y)
    	);
		x = x + btn14.WIDTH;

		ButtonCommand btn15 = new ButtonCommand(context, mModel, new MaxCommand(mModel));
		layer2.addView(btn15, 
    			new AbsoluteLayout.LayoutParams(btn15.WIDTH, btn15.HEIGHT, x, y)
    	);
		x = x + btn15.WIDTH;

		ButtonCommand btn16 = new ButtonCommand(context, mModel, new MinCommand(mModel));
		layer2.addView(btn16, 
    			new AbsoluteLayout.LayoutParams(btn16.WIDTH, btn16.HEIGHT,  x, y)
    	);


		x = 0;
		y = 0;
	    
	    AbsoluteLayout layer3 = new AbsoluteLayout(context);
	    layer3.setVisibility(INVISIBLE);

	    layerList.add(layer3);
	    
	    
	    ButtonCommand btn21 = new ButtonCommand(context, mModel, new PowCommand(mModel));
	    layer3.addView(btn21, 
    			new AbsoluteLayout.LayoutParams(btn21.WIDTH, btn21.HEIGHT, x, y)
    	);
		x = x + btn21.WIDTH;

		ButtonCommand btn22 = new ButtonCommand(context, mModel, new SqrtCommand(mModel));
		layer3.addView(btn22, 
    			new AbsoluteLayout.LayoutParams(btn22.WIDTH, btn22.HEIGHT, x, y)
    	);
		x = x + btn22.WIDTH;

		ButtonCommand btn24 = new ButtonCommand(context, mModel, new SinCommand(mModel));
		layer3.addView(btn24, 
    			new AbsoluteLayout.LayoutParams(btn24.WIDTH, btn24.HEIGHT, x, y)
    	);
		x = x + btn24.WIDTH;

		
		ButtonCommand btn23 = new ButtonCommand(context, mModel, new TanCommand(mModel));
		layer3.addView(btn23, 
    			new AbsoluteLayout.LayoutParams(btn23.WIDTH, btn23.HEIGHT, x, y)
    	);
		x = x + btn23.WIDTH;


		ButtonCommand btn25 = new ButtonCommand(context, mModel, new XrootCommand(mModel));
		layer3.addView(btn25, 
    			new AbsoluteLayout.LayoutParams(btn25.WIDTH, btn25.HEIGHT, x, y)
    	);
		x = x + btn25.WIDTH;

		ButtonCommand btn26 = new ButtonCommand(context, mModel, new XrootCommand(mModel));
		layer3.addView(btn26, 
    			new AbsoluteLayout.LayoutParams(btn26.WIDTH, btn26.HEIGHT,  x, y)
    	);

		
		x = 0;
		y = 0;
	    
	    AbsoluteLayout layer4 = new AbsoluteLayout(context);
	    layer4.setVisibility(INVISIBLE);

	    layerList.add(layer4);
	    
	    
	    ButtonCommand btn31 = new ButtonCommand(context, mModel, new Log1pCommand(mModel));
	    layer4.addView(btn31, 
    			new AbsoluteLayout.LayoutParams(btn31.WIDTH, btn31.HEIGHT, x, y)
    	);
		x = x + btn31.WIDTH;

		ButtonCommand btn32 = new ButtonCommand(context, mModel, new NegCommand(mModel));
		layer4.addView(btn32, 
    			new AbsoluteLayout.LayoutParams(btn32.WIDTH, btn32.HEIGHT, x, y)
    	);
		x = x + btn32.WIDTH;

		ButtonCommand btn34 = new ButtonCommand(context, mModel, new InvertCommand(mModel));
		layer4.addView(btn34, 
    			new AbsoluteLayout.LayoutParams(btn34.WIDTH, btn34.HEIGHT, x, y)
    	);
		x = x + btn34.WIDTH;

		
		ButtonNotImplemented btn33 = new ButtonNotImplemented(context, mModel, "");
		layer4.addView(btn33, 
    			new AbsoluteLayout.LayoutParams(btn33.WIDTH, btn33.HEIGHT, x, y)
    	);
		x = x + btn33.WIDTH;


		ButtonNotImplemented btn35 = new ButtonNotImplemented(context, mModel, "");
		layer4.addView(btn35, 
    			new AbsoluteLayout.LayoutParams(btn35.WIDTH, btn35.HEIGHT, x, y)
    	);
		x = x + btn35.WIDTH;

		ButtonNotImplemented btn36 = new ButtonNotImplemented(context, mModel, "");
		layer4.addView(btn36, 
    			new AbsoluteLayout.LayoutParams(btn36.WIDTH, btn36.HEIGHT,  x, y)
    	);

		
		
		
		
		x = 0;
		y = 0;
		
	    addView(layer1, 
    			new AbsoluteLayout.LayoutParams(WIDTH, HEIGHT, x, y)
    	);
	    addView(layer2, 
    			new AbsoluteLayout.LayoutParams(WIDTH, HEIGHT, x, y)
    	);
	    addView(layer3, 
    			new AbsoluteLayout.LayoutParams(WIDTH, HEIGHT, x, y)
    	);
	    addView(layer4, 
    			new AbsoluteLayout.LayoutParams(WIDTH, HEIGHT, x, y)
    	);

	
	}
	
	

}
